cmake_minimum_required(VERSION 3.20)

project(mini_leveldb LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)            
set(CMAKE_CXX_STANDARD_REQUIRED ON)   
set(CMAKE_CXX_EXTENSIONS OFF)         

set(EXECUTABLE ${PROJECT_NAME})

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Debug")
endif()

# 设置输出路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")

set(LEVELDB_BUILD_TESTS OFF)
set(LEVELDB_BUILD_BENCHMARKS OFF)

file(GLOB SRC_FILES
    "${CMAKE_CURRENT_SOURCE_DIR}/src/*.*"
    "${CMAKE_CURRENT_SOURCE_DIR}/src/util/*.*"
    "${CMAKE_CURRENT_SOURCE_DIR}/src/minidb/*.*"
    "${CMAKE_CURRENT_SOURCE_DIR}/src/port/*.*"
)

foreach(FILE IN LISTS SRC_FILES)
    message(STATUS "add ${FILE} to project ${EXECUTABLE}")
endforeach()

add_executable(${EXECUTABLE}
    ${SRC_FILES}
)

target_include_directories(${EXECUTABLE} PRIVATE
    ${CMAKE_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}/src/util
    ${CMAKE_CURRENT_SOURCE_DIR}/src/minidb/
    ${CMAKE_CURRENT_SOURCE_DIR}/src/port/
)

target_link_libraries(${EXECUTABLE} PRIVATE
)